home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 018a / wpcrack.zip / WPCRACK.DOC < prev    next >
Text File  |  1991-10-13  |  15KB  |  326 lines

  1. WPCRACK 1.0 - Word Perfect 5.x Password Finder
  2. Now, files with forgotten passwords are no longer lost forever!
  3.  
  4. Copyright (C)1991 Ron Dippold -- All Rights Reserved Except Those Given
  5.  
  6. You may freely distribute these files to anyone or any BBS and use the programs
  7. for free as long as you don't modify or delete any of these files.  I'm not
  8. responsible for any damage you do with this (I really hate legalese!).
  9.  
  10.  
  11.  
  12. What This Is
  13. ------------------------------------------------------------------------------
  14. Word Perfect's manual claims that "You can protect or lock your documents with
  15. a password so that no one will be able to retrieve or print the file without
  16. knowing the password - not even you," and "If you forget the password, there
  17. is absolutely no way to retrieve the document."  [1]
  18.  
  19. Pretty impressive!  Actually, you could crack the password of a Word Perfect
  20. 5.x file on a 8 1/2" x 11" sheet of paper, it's so simple.  If you are counting
  21. your files being safe, they are NOT.  Bennet [2] originally discovered how the
  22. file was encrypted, and Bergen and Caelli [3] determined further information
  23. regarding version 5.x.    I have taken these papers, extended them, and written
  24. some programs to extract the password from the file.
  25.  
  26. If you don't care about theory, skip to the next section (Why This Program).
  27.  
  28.  
  29. Stupid, Stupid, Stupid!
  30. -----------------------------------------------------------------------------
  31. Word Perfect allows you to add a password to a file.  When you save it, it will
  32. be encrypted, and it requires the password to uncrypt it.  Word Perfect
  33. encrypts the file by a method of two exclusive ORs.  First, it takes the length
  34. of the password plus 1 and increments this for each character, wrapping from
  35. 255 to 0.  This incrementing sequence is XORed with the text to be encrypted.
  36. Secondly, the password is repeatedly XORed with blocks of the plaintext of
  37. the same size as the password.
  38.  
  39. As a simple example, say the password is "BONE".  The incrementing sequence
  40. would start with 5 (one more than the number of characters in BONE).  BONE in
  41. hexidecimal is 42 4F 4E 45.
  42.  
  43.     Text:        H  e  l  l  o  !
  44.                              48 65 6C 6C 6F 21
  45.     Sequence:    05 06 07 08 09 0A
  46.     Password:    42 4F 4E 45 42 4F
  47.     -------------------------------
  48.     Result:      0F 2C 25 21 24 64
  49.  
  50. It also stores a 16-bit checksum that is computed as following:
  51.  
  52.     checksum = 0
  53.     for each character in the password {
  54.         rotate the checksum right by one bit
  55.         XOR the character into the high 8 bits of the checksum
  56.     }
  57.  
  58. Now, this method of encryption worked well in Word Perfect 4.x., where the
  59. actual text is the only thing encrypted.  To determine the password that was
  60. used, you would have to determine the characters and the length.  Not easy, and
  61. it would take lots of compuuting power, basically brute force trying different
  62. passwords that had the correct checksums (very thoughtful of them to leave that
  63. in there).
  64.  
  65. However, someone did a very dumb thing and extended this scheme to Word Perfect
  66. 5.x incorrectly.  In Word Perfect 5.x, when you encrypt a file IT ENCRYPTS
  67. INFORMATION THAT IS CONSTANT FROM FILE TO FILE.  There are certain bytes that
  68. are guaranteed to be the same always, and 22 total bytes that never seem to
  69. change.
  70.  
  71. What this means is that we have known plaintext for some encrypted text!  And
  72. because the method of encryption is so regular, it is a simple method to
  73. reverse the encryption method to find the password.  The password is repeatedly
  74. applied to the text, so we have a check.
  75.  
  76. Say we are trying a password length of 4.  We know the incrementing sequence
  77. must start at 5 (4+1).  So we XOR that, the first encrypted byte, and the known
  78. value of that byte and we get back a character.  This might be the first
  79. character of the password.  Now, we check it!  We just move over 4 bytes (since
  80. it repeats), increment the sequence number by 4, and repeat.  If the character
  81. is the same as the password we first got, this could be the password.
  82.  
  83. In reality, it's not so easy.  The known bytes are spread out, and for some
  84. password lengths there are some letters we can't figure out.  And if anything
  85. that I expect to stay constant changes that'll mess things up.
  86.  
  87. The first problem can be solved if there is only one missing character: since
  88. WP was so nice as to include the checksum, I can just try all possible values
  89. of the missing character until the checksum matches.
  90.  
  91. The second problem I deal with by trying to get up to five complete versions
  92. of the password for each length from different sections of the known info.
  93. Then I run a "vote" to see how well each charcter agrees with each other and
  94. an overall confidence level for that length.  Any that are above a threshold
  95. I explore further as shown below.
  96.  
  97. I also know that certain password values are forbidden, namely anything above
  98. 128 and lower case characters (they are translated to upper case) so this helps
  99. pare down the choices.
  100.  
  101. If there is more than one missing character (possible on very long passwords,
  102. above 14 characters), then it is up to the person running the program to figure
  103. out what they could possibly be.  After all, if it is "IMP_RTANT REPO_T" where
  104. the "_" are the missing characters, "IMPORTANT REPORT" should be obvious to
  105. most people.
  106.  
  107. The method is very flexible, it seems to get most passwords easily, and
  108. anything really strange should be caught by the flexible threshold.
  109.  
  110.  
  111.  
  112. Why This Program
  113. ------------------------------------------------------------------------------
  114. I know people are going to instantly accuse me of writing this just as a tool
  115. for hackers to steal confidential data.  However, I have seen too many people
  116. asking how to recover their own locked files ("I forgot my password!") and
  117. losing many hours to think that this does not have plenty of legitimate use.
  118.  
  119. The algorithm for cracking the programs has been available for quite some time,
  120. I just automated it and did some filling in the blanks.  Anyone who thought
  121. their files were safe when encrypted like this was fooling themselves (or were
  122. fooled by the claims made about the encryption).  What can I say, every tool
  123. has the potential for abuse.  The idea here is for you to save your files that
  124. you've forgotten the password to.
  125.  
  126. WPCRACK also has some purely technical interest value.  Watching how easily
  127. it can crack a WP file, even on a 4 MHz XT, can be unnerving.  The algorithm
  128. really doesn't take that much processing power.
  129.  
  130.  
  131.  
  132. How to Use It
  133. -------------------------------------------------------------------------------
  134.  
  135. The syntax is:
  136.    WPCRACK (-d) (-t) <filename> ( <threshold> )
  137.  
  138. Parameters:
  139.  
  140. <filename> is the Word Perfect file to crack.
  141.  
  142. <threshold> is the percentage confidence threshold over which a length is
  143. considered to be a possibility.  This can vary from 0 (always) to 100
  144. (only the best) and defaults to 80.  If you can't get a password from
  145. a file you KNOW is protected, lower the threshold.  You'll have more
  146. garbage to sort through, but you'll get something.
  147.  
  148. Switches:
  149.  
  150. -d : Normally when WPCRACK prints the characters, it prints the actual
  151.      characters. Unfortunately, control characters are allowed in passwords,
  152.      and these can do strange things to the screen output.  The -d switch
  153.      will print the decimal values of each character on the line below.  This
  154.      is not pretty, but may be the only option you have to find out what
  155.      character that really is.
  156.  
  157. -t : This will force WPCRACK to print all answers in table form, rather
  158.      that using special displays for passwords with one or no missing
  159.      characters (see below).  This lets you see ALL possible passwords.
  160.  
  161. Note:
  162.  
  163. WPCRACK can spit out quite a bit out output.  You might consider redirecting
  164. the output to a file by adding a "> filename" to the end of the line if it goes
  165. by too fast.  This will send all the output to the file, which you can then
  166. edit, print, or do whatever you want with.  For example:
  167.  
  168.   WPCRACK MYFILE.WP > OUTPUT.TXT
  169.  
  170. And then you can view or print OUTPUT.TXT
  171.  
  172.  
  173.  
  174. The Results
  175. -------------------------------------------------------------------------------
  176. WPCRACK will check the file for passwords of length 1 to 17 currently.  It will
  177. generate up to five passwords for each length (less for the larger passwords,
  178. as we only have 22 bytes to work with total).  It then decides how closely
  179. all the guesses agree with each other.  If we chose the wrong length, we would
  180. expect the different guesses to be almost random.  If the length is correct,
  181. they should almost all agree.
  182.  
  183. WPCRACK weights the results for each length to get a "confidence level" and
  184. then compares that to the threshold.  Any below the threshold are automatically
  185. discarded and no longer figure in anything more.
  186.  
  187. The remaining lengths are sorted by confidence level, highest to lowest.  Then
  188. for each of the lengths, the following is done.
  189.  
  190. CRACKWP checks to see how many missing letters there are.  These are positions
  191. in the password that we have absolutely _no_ guesses for.
  192.  
  193. No Missing Characters:
  194.  
  195. If there are no missing characters, WPCRACK tried every combination of the
  196. possible characters for each position.  It determines the checksum for that
  197. combination, and if it matches the checksum stored in the file, it prints the
  198. password.
  199.  
  200. For a file where the correct password is "PASS1" you will see:
  201.  
  202.   PASS1   -- Good Checksum
  203.  
  204.  
  205. One Missing Character:
  206.  
  207. When there is only one missing character, WPCRACK makes use of the checksum
  208. stored in the file.  It generates every combination of the known characters
  209. in the password.  Then it works backwards from these and the checksum to
  210. figure out what the character must have been.  If the character is a legal
  211. character for a password, the resulting password is printed.
  212.  
  213. For a file where the correct password is "BIG_PASSWORD" you might see:
  214.  
  215.  
  216.   BIG_PASSWO D
  217.             ^ 
  218.  The missing character will be extrapolated from the checksum
  219.  
  220.   BIG_PASSWORD   -- Good Checksum
  221.  
  222.  
  223. More Missing Characters or Table Mode:
  224.  
  225. When there is more that one missing character, there isn't anything to do
  226. except show you all the possibilities and let the superior text recognition
  227. system in your head see if it recognizes anything reasonable.
  228.  
  229. In addition, if just letting WPCRYPT run doesn't produce the desired results,
  230. this will let you bypass all the extra processing and do it yourself straight
  231. from the possibilities.
  232.  
  233. The format of a password table for a length is:
  234.  
  235.    # of matches: 43355
  236.   Primary Guess: PASS1  Checksum good!
  237.  
  238. The "Primary Guess" means that all these characters are the best guesses for
  239. each position.  The numbers above them are the number of occurences of each
  240. character.  In the above example, there were 4 places that WPCRACK attempted to
  241. determine the first character of the password.  "P" turned up 4 times.  "A"
  242. turned up in the second position 3 times.  The number of times per character
  243. varies because the known bytes are not evenly distributed.
  244.  
  245. In this case, the checksum of the primary guess matched, so it shows that.
  246.  
  247. Now if we have a case where there are multiple character possibilities for
  248. one or more positions, you will see something like this:
  249.  
  250. Password length of 15 with 20% confidence level:
  251.  
  252.    # of matches: 111111101100121
  253.   Primary Guess: FWII/N E'  Y];  (Incomplete!)
  254.  
  255.    # of matches: 100010000100001
  256.      Alternates: Z            ?
  257.  
  258. In this case, there are three characters that we have no clue about (the ones
  259. with zeros above them in the primary guess.  There is another line of counts
  260. and characters below it - these are more possibilities.  Here, the first
  261. character of the password is equally likely to be a "F" or "Z".  A more useful
  262. useful result might be something like this if you force table mode:
  263.  
  264.    # of matches: 43353
  265.   Primary Guess: HELLA  Checksum bad!
  266.  
  267.    # of matches: 00002
  268.      Alternates:     O
  269.  
  270. In this case, three times the last character turned out to be "A", and twice it
  271. was "O".  "O" was the correct letter, apparently, for then it would spell
  272. "HELLO".  Table mode lets you see this, although the "no missing characters"
  273. display should have picked the "HELLO" correctly as well.  I'm sure there is
  274. some good use for this...  It's too nifty to leave out and makes a good
  275. safety net.
  276.  
  277.  
  278.  
  279. Notes
  280. -------------------------------------------------------------------------------
  281.   The longer the password used, the less chance of determining all of it.
  282. Luckily, most people don't use passwords greater than 13 characters, and
  283. CRACKWP should get anything less than that.  And when CRACKWP can't figure it
  284. out, you will be shown all of the password that it can figure out and you might
  285. be able to do something with what's shown, just like a crossword puzzle.
  286.  
  287.   If any of the 22 bytes I assumed are constant change, then things get
  288. hairy!  This is why I do all the contortions with voting, table display, etc.
  289. Unless the change is really drastic, CRACKWP should be able to find it anyway.
  290.  
  291.   I'd suggest the folks at Word Perfect use a different method in version 6.0!
  292. For a product such as this, it's really bad that it's so insecure.  This is
  293. good for those of us who forget our passwords, but bad for someone who thinks
  294. their data is safe.
  295.  
  296.   I haven't tried this on any Word Perfect 5.x other than the IBM version.  If
  297. you have it for another computer and are interested in getting a version for
  298. it, and you have InterNet access, send me the following:  a UUENCODED (short)
  299. Word Perfect 5.x file, a UUENCODED version of the file after it has been
  300. saved with a password, and a letter saying hello and the password you used.
  301. See my address below.
  302.  
  303.  
  304.  
  305. References
  306. -------------------------------------------------------------------------------
  307. [1] "WordPerfect for IBM Personal Computers" WordPerfect Corporation, 1989
  308. [2] Bennet,J "Analysis of the Encryption Algorith used in the Word Perfect
  309.     Word Processing Program" 1987, "Cryptologia" Vol XI, No. 4. pp 206-210
  310. [3] Bergen, H.A. and Caelli, W. J. "File Security in WordPerfect 5.0" 1990,
  311.     "Cryptologia"
  312.  
  313.  
  314. ==============================================================================
  315. You can reach me at my InterNet address of rdippold@qualcomm.com or contact
  316. me at one of the fine boards below:
  317.  
  318. Board                   Phone                    My Username
  319. -------------------------------------------------------------
  320. ComputorEdge On-Line    (619) 573-1635           SYSOP .
  321. Farstar                 (619) 225-1775           Iceman
  322. Maiden Spectrum         (619) 566-4165           Iceman
  323. Radio-Active            (619) 268-9625           Iceman
  324. The Void                (619) 455-5957           Iceman
  325.  
  326.